package com.woniu.adopt_web.controller;

import com.woniu.adopt_web.entity.ViewPage;
import com.woniu.adopt_web.service.IndexService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import java.util.ArrayList;
import java.util.List;

@Controller
public class IndexController {

    @Autowired
    private IndexService indexService;

    @RequestMapping({"/","index.html"})
    public String index(Model model){
        List<ViewPage> viewPages = indexService.initViewPage();
        model.addAttribute("pageList",viewPages);
        return "index";
    }
}
